Shader "Unlit/NewUnlitShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _BurnMap("Burn Map", 2D) = "white"{}
        //_BurnAmount ("Burn Amount", Range(0.0, 1.0)) = 0.0
        //_DarkRate ("Dark Rate", Range(0.0, 1.0)) = 0.0
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            // make fog work
            #pragma multi_compile_fog

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uvMainTex : TEXCOORD0;
                float2 uvBurnMap : TEXCOORD1;
                //UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            sampler2D _BurnMap;
            fixed _BurnAmount;
            fixed _DarkRate;

            float4 _MainTex_ST;
            float4 _BurnMap_ST;

            v2f vert (appdata v)
            {
                v2f o;
                float4 offset = float4(0.0, 0.0, 0.0, 0.0);
                o.vertex = UnityObjectToClipPos(v.vertex + offset);
                //o.vertex.x += _SinTime.z;
                //o.vertex.y += sin(_Time * 200) / 16;

                o.uvMainTex = TRANSFORM_TEX(v.uv, _MainTex);
                o.uvBurnMap = TRANSFORM_TEX(v.uv, _BurnMap);
                //UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                // sample the texture
                fixed4 col = tex2D(_MainTex, i.uvMainTex);
                //fixed4 burn = tex2D(_BurnMap, i.uvBurnMap);
                //_BurnAmount = _SinTime.w;
                //clip(burn.r - _BurnAmount);

                // apply fog
                //UNITY_APPLY_FOG(i.fogCoord, col);

                //_DarkRate = 1 - _DarkRate;
                _DarkRate = 1;
                //_DarkRate = lerp(0.5, 1, saturate(_SinTime.z + 0.5));
                col.rgb *= fixed3(_DarkRate, _DarkRate, _DarkRate);
                return col;
            }
            ENDCG
        }
    }
}
